﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Perspective.Wpf3D.Primitives;
using Perspective.Wpf3D.Sculptors;

namespace Perspective.Wpf3D.Shapes
{
    /// <summary>
    /// 中空结构长方体型
    /// A 3D hollow box element.
    /// The same material is used for all the faces through the Material property.
    /// Default size of a side is 1.0.
    /// </summary>
    public class HollowBox3D :BoxElement3D
    {
         #region Constructors
        /// <summary>
        /// Static constructor.
        /// No default back material for 3D closed shapes.
        /// </summary>
        static HollowBox3D()
        {
            BackMaterialProperty.OverrideMetadata(
                typeof(HollowBox3D),
                new PropertyMetadata(
                    null,
                    VisualPropertyChanged));

            DefaultTextureMappingProperty.OverrideMetadata(
                typeof(HollowBox3D),
                new PropertyMetadata(
                    true));
        }
        #endregion

        #region Properties

        #endregion

        // private BoxSculptor _sculptor = new BoxSculptor();

        /// <summary>
        /// Called by UIElement3D.InvalidateModel() to update the 3D model.
        /// </summary>
        protected override void OnUpdateModel()
        {
            Sculptor = new BoxSculptor(VisibleSides, Length, Width, Height);
            // _sculptor.Initialize(VisibleSides);
            //_sculptor.BuildMesh();
            //Geometry = _sculptor.Mesh;
            base.OnUpdateModel();
        }
    }
}
